import {uniqueId} from '@/utils';
import {makeRequiredRule} from '../../utils';

const label = '开关';
const name = 'switch';

export default {
	icon: 'icon-switch',
	label,
	name,
	rule() {
		return {
			type: name,
			field: uniqueId(),
			title: label,
			info: '',
			col:12,
			showLable:true,
			labelWidth:'',
			$required: false,
			props: {},
		};
	},
	props() {
		return [makeRequiredRule(), {
			type: 'switch',
			field: 'disabled',
			title: '是否禁用'
		}, {
			type: 'input-number',
			field: 'width',
			title: '宽度（px）',
			props: {
				min: 0
			}
		}, {
			type: 'input',
			field: 'activeText',
			title: 'switch 打开时的文字描述'
		}, {
			type: 'input',
			field: 'inactiveText',
			title: 'switch 关闭时的文字描述'
		}, {
			type: 'input',
			field: 'activeValue',
			title: 'switch 打开时的值'
		}, {
			type: 'input',
			field: 'inactiveValue',
			title: 'switch 关闭时的值'
		}, {
			type: 'input',
			field: 'activeColor',
			title: 'switch 打开时的背景色'
		}, {
			type: 'input',
			field: 'inactiveColor',
			title: 'switch 关闭时的背景色'
		}];
	}
};